#pragma once

#include "fxcc/core/graph/opengl3/pch.h"
#include "fxcc/core/graph/opengl3/Texture.h"


namespace fxcc
{
	namespace graph
	{
		namespace opengl3 
		{
            struct FXCC_API TextureCubeJack :public fxcc::graph::opengl3::Texture, public fxcc::graph::common::TextureCubeJack
            {
                TextureCubeJack();

                TextureCubeJack(const Desc& desc);
                
                bool Init();
                
                bool InitHDR();

                bool InitAlloc();

                bool InitDDS();
                
                bool InitImage6();

                void Load();
                
                bool GenerateFaceTexture2D(bool gamma=false);

                bool CreateFaceImages(const std::string& pathMustache, bool gamma = false);

                bool CreateCubeDDS(const std::string& ddsPath);;

                bool CreateCubeDDSMipmap(const std::string &ddsPath);

                int GetFaceTarget(int index);

                void SetShader(int index) const override
                {
                    Active(index);
                }
            public:

                static void UnBind()
                {
                    glBindTexture(Target(), 0);
                }
            private:

                static std::string EquirectangluarToCubeMapFragCode();

                static std::string GetFacePath(const std::string& must, int index);

                static const std::string cubeFaceFragCode();

                static int Target()
                {
                    return GL_TEXTURE_CUBE_MAP;
                }
            
            };
		}
	}
}
